/*
 * @作者：rocyuan（袁鹏）
 * @邮箱：roc@rocyuan.top、rocyuan666@163.com
 * @微信：rocyuan666
 * @个人网站：http://rocyuan.top
 *
 * vuex 模块化 - about模块
 */
import { asyncTasks } from 'roc-utils/dist/roc-utils.es.js'
import { getCaptcha } from '@/api/about'

const state = () => ({
  captchaData: {},
})

const getter = {}

const mutations = {
  setCaptchaData: (state, data) => {
    state.captchaData = data
  },
}

const actions = {
  async getCaptchaData({ commit }) {
    const [err, res] = await asyncTasks(getCaptcha())
    if (err) return console.log(err)
    commit('setCaptchaData', res.data)
  },
}

export default {
  state,
  getter,
  mutations,
  actions,
}
